#ifndef MYPLAYER_H
#define MYPLAYER_H

#include <vector>
#include "flag.h"
#include "unitframe.h"
#include "types.h"
#include "npc.h"

class myPlayer
{
    private:
        position pos;
        float velX, velY;
        int dir;
        int movementSpeed;
        int hp, mp;
        int maxhp, maxmp;
        float timer;
        //int inCombat;

        SDL_Rect box;
        SDL_Rect myClip[8];
        SDL_Surface *nameText;

        Npc *combatNpc;
        Flag *myFlag;
        UnitFrame *myUF;
        std::vector<position> path;

        std::stringstream position_text;
        std::string name;

        void update_rect();
        void calculate_vel();
        void set_clips();
        void stop();
        position attack_pos(Npc* npc);

    public:
        myPlayer();
        ~myPlayer();

        void handle_input();
        void move(Uint32 deltaTicks);
        void work(Uint32 deltaTicks);
        void walk_to(int x, int y);
        //void attack(int npcx, int npcy, int npcid);
        void attack(Npc* npc);
        void draw();

        void set_name(std::string name);
        void gen_nameText();
        void set_camera();
        void send_position();
        void send_flag(int x, int y);
        void send_attack(int npcid);
        void draw_position();

        int x();
        int y();
        void set_x(int x);
        void set_y(int y);

        int get_hp();
        int get_maxhp();
        void add_hp(int hp);
        void add_maxhp(int maxhp);

        int get_mp();
        int get_maxmp();
        void add_mp(int mp);
        void add_maxmp(int maxmp);
};

#endif // MYPLAYER_H
